/**
 * Author shuqi
 * Rev
 * Date: 2021-07-31 16:54
 * <p>
 * Copyright (C) 2021 Seeyon, Inc. All rights reserved.
 * <p>
 * This software is the proprietary information of Seeyon, Inc.
 * Use is subject to license terms.
 * @company seeyon.com
 * @author shuqi
 * @since V5 V7.1
 */
package com.synnex.springboot.config;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.WebApplicationInitializer;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.util.Set;

/**
 * @description
 * @date 2021-07-31 16:54
 * @since V5 V7.1
 * @author xiaol
 */
public class MySpringServletContainerInitializer implements ServletContainerInitializer, ApplicationContextAware {

	private static ApplicationContext applicationContext;

	@Override
	public void onStartup(Set<Class<?>> set, ServletContext servletContext) throws ServletException {
		MyWebApplicationInitializer.setApplicationContext(applicationContext);
		WebApplicationInitializer webApplicationInitializer = new MyWebApplicationInitializer();
		webApplicationInitializer.onStartup(servletContext);
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) {
		this.applicationContext = applicationContext;
	}
}
